<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="../css/aui.css">
    <link rel="stylesheet" type="text/css" href="../css/button.css">
    <style type="text/css">
        .sec1 {
            margin-top: 200px;
        }

        body {
            background: #fff url("../res/img/login_bg.jpg") no-repeat left top;
            background-size: 100%;
        }

        input {
            opacity: 1;
        }

        .sec2 {
            margin-left: 35px;
            margin-right: 35px;
        }

        #ul1 {
            border-radius: 0.5rem;
        }

        li {
            list-style: none;
            margin: 0;
            padding: 0;
            padding-left: 0.75rem;
            color: #212121;
            position: relative;
            min-height: 2.2rem;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            display: -webkit-box;
            display: -webkit-flex;
            display: flex;
            -webkit-box-pack: justify;
            -webkit-justify-content: space-between;
            justify-content: space-between;
        }

        #li1 {
            border-bottom: 1px solid #dddddd;
        }
    </style>
</head>

<body style="opacity:0.6">
    <section class="sec1 sec2">
        <ul id="ul1" class="aui-list aui-form-list">
            <li id="li1">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label-icon">
                        <i class="aui-iconfont aui-icon-mobile"></i>
                    </div>
                    <div class="aui-list-item-input">
                        <input id="username" class="aui-font-size-20" type="number" placeholder="请输入职工号">
                    </div>
                </div>
            </li>
            <li>
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label-icon">
                        <i class="aui-iconfont aui-icon-lock"></i>
                    </div>
                    <div class="aui-list-item-input">
                        <input id="password" class="aui-font-size-20" type="password" placeholder="请输入密码">
                    </div>
                    <div onclick="showPassword()" class="aui-list-item-label-icon">
                        <i class="aui-iconfont aui-icon-display"></i>
                    </div>
                </div>
            </li>
        </ul>
    </section>

    <section class="aui-content-padded sec2" style="margin-top:35px;">
        <div class="aui-btn aui-font-size-18 aui-btn-block aui-btn-info aui-btn-sm" onclick="login()" style="border-radius:0.5rem;">登 录</div>
    </section>

</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/aui-dialog.js"></script>
<script type="text/javascript" src="../script/config.js"></script>
<script type="text/javascript">
    var activity;
    var config;
    apiready = function() {
        api.parseTapmode();
        activity = api.require('UILoading');
        config = getConfig();
    };
    var username = document.getElementById("username");
    var password = document.getElementById("password");
    username.value = "13669924309";
    password.value = "1";

    //判断角色权限
    // switch (roleNames) {
    //     case "超级管理员":
    //         alert("超级管理员");
    //         break; //admin        1
    //     case "教师":
    //         alert("教师");
    //         break; //13669924309  1
    //     case "院领导":
    //         alert("院领导");
    //         break; //13899990102  1
    //     case "班主任":
    //         alert("班主任");
    //         break; //13199820711  1
    //     case "教辅人员":
    //         alert("教辅人员");
    //         break; //15739560045  1
    //     default:
    //         alert("用户信息错误")
    // }

    function login() {
        activity.keyFrame({
            rect: {
                w: 80,
                h: 100
            },
            styles: {
                bg: 'rgba(0,0,0,0.5)',
                corner: 5,
                interval: 50,
                frame: {
                    w: 80,
                    h: 80
                }
            }
        }, function(ret) {
            alert(JSON.stringify(ret));
        });
        api.ajax({
            url: 'http://' + config.serverIp + '/XSKQ/login.do',
            method: 'post',
            data: {
                values: {
                    password: password.value,
                    username: username.value
                },
            }
        }, function(ret, err) {
            if (ret) {
                if (ret.success) {
                    api.openWin({
                        name: 'main_win',
                        url: 'main/main_win.html',
                        bounces: false,
                        pageParam: {
                            name: 'test'
                        }
                    });
                    activity.closeKeyFrame();
                } else {
                    alert(ret.msg);
                    activity.closeKeyFrame();
                }
            } else {
                activity.closeKeyFrame();
                alert(JSON.stringify(err));
            }
        });
    }

    function showPassword() {
        if (password.type == "password") {
            password.type = "text";
        } else {
            password.type = "password";
        }
    }

</script>

</html>
